<template>
	<view class="message-view">
		<view class="message-view-chat-group">
			<view class="message-view-chat-group-item" v-for="item in chatGroupListData" :key="item.chatGroupName">
				<view class="message-view-chat-group-item-icon-group">
					<view :class="'group-images-'+item.icons.length ">
						<image v-for="(icon,index) in item.icons" :src="icon.icon"></image>
					</view>
				</view>
				<view class="message-view-chat-group-item-body">
					<view class="group-body-name">
						<text>{{item.chatGroupName}}</text>
					</view>
					<view class="group-body-last-message">
						<text>{{item.lastMessage}}</text>
					</view>
				</view>
				<view class="message-view-chat-group-item-last-time">
					<text>{{item.lastChatTime}}</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				chatGroupListData: [
					{
						chatGroupName: 'ABC的群聊1',
						icons: [
							{
								icon: '/static/icon/myself/order.svg'
							}
						],
						lastMessage: '这个不对啊',
						lastChatTime: '08:09'
					},
					{
						chatGroupName: 'ABC的群聊2',
						icons: [
							{
								icon: '/static/icon/myself/order.svg'
							},
							{
								icon: '/static/icon/myself/fankui.svg'
							}
						],
						lastMessage: '这个不对啊',
						lastChatTime: '02-02'
					},
					{
						chatGroupName: 'ABC的群聊3',
						icons: [
							{
								icon: '/static/icon/myself/fankui.svg'
							},
							{
								icon: '/static/icon/myself/address.svg'
							},
							{
								icon: '/static/icon/myself/order.svg'
							}
						],
						lastMessage: '这个不对啊',
						lastChatTime: '08:09'
					},
					{
						chatGroupName: 'ABC的群聊4',
						icons: [
							{
								icon: '/static/icon/myself/fankui.svg'
							},
							{
								icon: '/static/icon/myself/address.svg'
							},
							{
								icon: '/static/icon/myself/kefu.svg'
							},
							{
								icon: '/static/icon/myself/order.svg'
							}
						],
						lastMessage: '这个不对啊',
						lastChatTime: '02-02'
					}
				]
			}
		}
	}
</script>

<style scoped lang="scss">
	.message-view {
		
		.message-view-chat-group {
			background-color: #fdfdfd;
			
			.message-view-chat-group-item {
				display: flex;
				justify-content: center;
				align-items: center;
				
				.message-view-chat-group-item-icon-group {
					width: 160rpx;
					height: 160rpx;
					border-radius: 10rpx;
					border: 1rpx solid #cccccc;
					margin-left: 20rpx;
					align-items: center;
					justify-content: center;
					
					[class^="group-images-"] {
						background-color: #ffffff;
						border-radius: 10rpx;
						width: 100%;
						height: 100%;
						display: flex;
						flex-wrap: wrap;
						align-items: center;
						justify-content: center;
						text-align: center;
						
						image {
							width: 60rpx;
							height: 60rpx;
						}
					}
					
					.group-images-1 {
						image {
							width: 120rpx;
							height: 120rpx;
						}
					}
				}
				.message-view-chat-group-item-body {
					line-height: 80rpx;
					width: 400rpx;
					margin-left: 20rpx;
					
					.group-body-name {
						
					}
					
					.group-body-last-message {
						
					}
				}
				
				.message-view-chat-group-item-last-time {
					text-align: center;
					line-height: 158rpx;
					width: 140rpx;
				}
				
				.message-view-chat-group-item-body, 
				.message-view-chat-group-item-last-time {
					border-top: 1rpx solid #cccccc;
				}
				
				.message-view-chat-group-item-body:nth-child(1) {
					border-top: 0rpx !important;
				}
			}
		}
	}
</style>